package ua.dou.loader;

import android.content.Context;
import android.os.Bundle;
import com.google.code.rome.android.repackaged.com.sun.syndication.feed.synd.SyndFeed;

/**
 * Rss Loader.
 * User: David Mayboroda
 */
public class RssLoader extends BaseLoader<SyndFeed> {

    public static final String URL_FLAG = "bundle_url_flag";
    private String url;

    public RssLoader(Context context, Bundle bundle) {
        super(context);
        if (!bundle.isEmpty()) {
            if(bundle.containsKey(URL_FLAG)) {
                this.url = bundle.getString(URL_FLAG);
            }
        }
    }

    public RssLoader(Context context, String url) {
        super(context);
        this.url = url;
    }

    @Override
    public SyndFeed load() throws Exception {
        return reader.parse(url);
    }
}
